package slowestKey;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Solution {
    public char slowestKey(int[] releaseTimes, String keysPressed) {
        // 思路 找到差值最大的
        int max = releaseTimes[0];
        char ans = keysPressed.charAt(0);
        for (int i = 1; i < releaseTimes.length ; i++) {
            if(releaseTimes[i]-releaseTimes[i-1]>max){
                max = releaseTimes[i] - releaseTimes[i-1];
                ans = keysPressed.charAt(i);
            }else if(max == releaseTimes[i] - releaseTimes[i-1]){
                ans = (char) Math.min(ans,keysPressed.charAt(i));
            }
        }
        return ans;
    }
}
